package com.modulemanager.page

import android.content.Context
import com.libbase.Wrapper
import com.libservice.RouteCompletion
import com.libui.navigatonbar.MenuData
import com.modulemanager.models.PageConfig
import com.modulemanager.module.ModuleInterface
import com.modulemanager.views.PageFragmentContainer

interface PageInterface {

    interface Builder {
        val type: String

        fun build(
            module: ModuleInterface,
            id: String?,
            config: PageConfig?,
            params: Map<String, Any>?,
            hash: String?
        ): PageInterface?
    }

    var context: Context?

    var module: ModuleInterface?

    val type: String

    val id: String?

    var config: PageConfig

    var params: MutableMap<String, Any>?

    val hash: String?

    var completion: RouteCompletion?

    var popDelta: Int

    var completionParam: Any?

    val fragmentContainer: PageFragmentContainer

    fun startActivity(intentFlags: Int?, animated: Boolean): Boolean

    fun setTitle(title: String?, subTitle: String?) {
        config.setTitle(title, subTitle)
    }

    fun setSubTitle(subTitle: String?) {
        config.setSubTitle(subTitle)
    }

    fun setRightMenus(menus: List<MenuData>?) {
        config.rightMenus.onNext(Wrapper(menus))
    }

    fun containsPage(
        moduleType: String,
        moduleId: String?,
        pageType: String,
        pageId: String?
    ): Boolean {
        return false
    }

    fun showPage(
        moduleType: String,
        moduleId: String?,
        pageType: String,
        pageId: String?
    ): Boolean {
        return false
    }

    fun updateStatusBar()
}